Anyone saw a worst written function than this? [closed]

Posted by fvoncina on Stack Overflow See other posts from Stack Overflow or by fvoncina
Published on 2010-04-26T23:39:10Z Indexed on 2010/04/26 23:43 UTC
Read the original article Hit count: 127

Filed under:
  string sUrl = "http://www.ipinfodb.com/ip_query.php?ip=" + ip + "&output=xml";
  StringBuilder oBuilder = new StringBuilder();
  StringWriter oStringWriter = new StringWriter(oBuilder);
  XmlTextReader oXmlReader = new XmlTextReader(sUrl);
  XmlTextWriter oXmlWriter = new XmlTextWriter(oStringWriter);
  while (oXmlReader.Read())
  {
   oXmlWriter.WriteNode(oXmlReader, true);
  }
  oXmlReader.Close();
  oXmlWriter.Close();
  // richTextBox1.Text = oBuilder.ToString();
  XmlDocument doc = new XmlDocument();
  doc.LoadXml(oBuilder.ToString());
  doc.Save(System.Web.HttpContext.Current.Server.MapPath(".") + "data.xml");

  DataSet ds = new DataSet();
  ds.ReadXml(System.Web.HttpContext.Current.Server.MapPath(".") + "data.xml");
  string strcountry = "India";
  if (ds.Tables[0].Rows.Count > 0)
  {
   strcountry = ds.Tables[0].Rows[0]["CountryName"].ToString();

  }

© Stack Overflow or respective owner

Related posts about c#